#ifndef PD_TRANSPORT_H_
#define PD_TRANSPORT_H_

#include "pd_define.h"

#define TRANSPORT_LOOP_INTERVAL 10000 //10ms

PD_CPP_START

struct PdTransport;
typedef PdTransport PdTransport;

typedef void (*pd_on_interval_pt) (PdTransport *ts, void *arg);

extern PdTransport *pd_transport_init();

extern void pd_transport_destroy(PdTransport *ts);

extern void pd_transport_set_timer(PdTransport *ts, pd_on_interval_pt on_interval, void *arg);

extern int pd_transport_run(PdTransport *ts);

extern int pd_transport_stop(PdTransport *ts);

extern int pd_transport_wait(PdTransport *ts);

extern int pd_transport_add_ioc(PdTransport *ts, PdIOComponent *ioc, int enable_read, int enable_write);

extern int pd_transport_set_ioc(PdTransport *ts, PdIOComponent *ioc, int enable_read, int enable_write);

extern int pd_transport_remove_ioc(PdTransport *ts, PdIOComponent *ioc);

PD_CPP_END

#endif
